# -*- coding: utf-8 -*-

'''
Created on 27/02/2010

@author: vincent.vanghelle
'''

from django import forms
from django.http import HttpResponseRedirect
from mmorganizer.games.models import Game, Class, Role, Serveur
from mmorganizer.characters.models import Personnage, Roster
from mmorganizer.events.models import Evenement
from django.contrib.admin import widgets       
     
class EvenementCreationForm(forms.ModelForm):
    def initialiser(self,game_id,user_id):
        self.fields['roster'].queryset = Roster.objects.filter(game__id=game_id).filter(responsable__id=user_id)
        
    class Meta:
        model = Evenement
        exclude=['available','unavailable','substitutes']

    def __init__(self, *args, **kwargs):
        super(EvenementCreationForm, self).__init__(*args, **kwargs)
        self.fields['dateEvent'].widget = widgets.AdminDateWidget()
        self.fields['timeEvent'].widget = widgets.AdminTimeWidget()

    
